﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EzDesk.Apps.ServiceImpl.Attendance.Repositories.Interface;
using EzDesk.Apps.Model.Attendance;

namespace EzDesk.Apps.ServiceImpl.Attendance.Repositories
{
    public class ExtraShiftRepository:IExtraShiftRepository
    {
        EzDeskAttendanceDataContext _db;

        public ExtraShiftRepository(EzDeskAttendanceDataContext db)
        {
            this._db = db;
        }

        public ExtraShift GetExtraShiftInfo(DateTime date)
        {
            return (from e in _db.ez_ExtraShifts
                    where e.StartDay <= date && date <= e.EndDay
                    select new ExtraShift()
                    {
                        Id = e.ExtraShiftId,
                        Name = e.ShiftName,
                        StartDate = e.StartDay,
                        EndDate = e.EndDay,
                        NeedToWork = e.NeedWork,
                    }).SingleOrDefault();
        }

        public Guid Add(ExtraShift model, bool saveChanges)
        {
            throw new NotImplementedException();
        }

        public ExtraShift GetById(Guid id)
        {
            throw new NotImplementedException();
        }

        public IQueryable<ExtraShift> GetAll()
        {
            throw new NotImplementedException();
        }

        public void Delete(Guid id, bool saveChanges)
        {
            throw new NotImplementedException();
        }

        public void Update(ExtraShift model, bool saveChanges)
        {
            throw new NotImplementedException();
        }

        public void SaveChanges()
        {
            throw new NotImplementedException();
        }
    }
}
